package br.com.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;

import br.com.bean.ServicoBean;

public class ServicoDAO {
	public void inserir(Connection conn, ServicoBean value) throws Exception {
	String sql ="INSERT INTO servico(id, cliente, problema, contato, executado, tecnico, solicitado,previsao, kminicial, kmfinal, veiculo, fechado, dataexecutado,resolvido)VALUES (?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?,?)";

	PreparedStatement ps = conn.prepareStatement(sql);
	ps.setInt(1, value.getId());
	ps.setInt(2, value.getCliente().getId());
	ps.setString(3, value.getProblema());
	ps.setString(4, value.getContato());
	ps.setString(5, value.getExecutado());
	ps.setInt(6, value.getTecnico().getId());
	ps.setDate(7, value.getDataSolici());
	ps.setDate(8, value.getDataPrev());
	ps.setDouble(9, value.getKmInicial());
	ps.setDouble(10, value.getKmInicial());
	ps.setInt(11, value.getVeiculo().getId());
	ps.setString(12, value.getFechado());
	ps.setDate(13, value.getDataExecutado());
	ps.setString(14, value.getResolvido());
	
	ps.execute();
	ps.close();

	}

}
